<%var csstpl = {%>

    <%};%>
        <%var jstpl = {%>
            <script>
                var app = new Vue({
                    el: "#content",
                    data: {
                        query: {
                            agent_id: '${agentId}',
                            pageNumber: 1,
                            pageSize: 10
                        },
                        data_result: [],
                    },
                    created: function() {
                        this.loadPage("init")
                    },
                    mounted() {
                        let form = layui.form;
                        let that = this;
                    },
                    methods: {
                        loadPage: function(model) { //载入模式有两种  init初始化载入 load分页载入
                            if (model == "init") {
                                this.query.pageNumber = 1;
                            }
                            Ajax("/system/agent/orderList", this.query, function(d) {
                                console.log(d);
                                app.data_result = d.list;
                                if (d.firstPage == true) {
                                    layui.laypage.render({
                                        elem: 'gexin_page' //注意，这里的 test1 是 ID，不用加 # 号
                                            ,
                                        layout: ['count', 'prev', 'page', 'next',
                                            'limit', 'skip'
                                        ],
                                        count: d.totalRow //数据总数，从服务端得到
                                            ,
                                        limit: app.query.pageSize,
                                        jump: function(obj, first) {
                                            app.query.pageNumber = obj.curr;
                                            if (app.query.pageSize != obj.limit) {
                                                app.query.pageSize = obj.limit;
                                                app.loadPage("init");
                                                return;
                                            }
                                            if (!first) {
                                                app.loadPage("load");
                                            }
                                        }
                                    });
                                }
                            })
                        }
                    }
                })
            </script>
            <%};%>
                <%layout("../layout/_layout_layui.html",{title:"代理商订单明细",jstpl:jstpl,csstpl:csstpl}){%>
                    <div class="layui-row" id="content" v-cloak>
                        <!-- <div class="layui-col-md10">
                            <div class="layui-form-item ">
                                <div class="layui-input-inline">
                                    <input type="text" v-model="query.name" placeholder="输入代理商名称模糊查询" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-input-inline">
                                    <input type="text" v-model="query.phone" placeholder="输入联系电话模糊查询" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-md2">
                            <div class="layui-form-item">
                                <a @click="loadPage" class="layui-btn"><i class="layui-icon">&#xe615;</i> 查询/筛选</a>
                            </div>
                        </div> -->
                        <div class="layui-col-md12" style="margin-top: 20px">
                            <table class="layui-table ">
                                <!-- <thead>
                                    <tr>
                                        <th>订单id</th>
                                        <th>操作</th>
                                    </tr>
                                </thead> -->
                                <tr class="title">
                                    <td>商品</td>
                                    <td>单价/数量</td>
                                    <td>售后</td>
                                    <td>运费</td>
                                    <td>订单金额</td>
                                    <!-- <td>涨价或减价</td> -->
                                    <td>配送地址</td>
                                    <td>下单时间</td>
                                    <td>收件人</td>
                                    <td>订单状态</td>
                                </tr>
                                <tbody v-for="d in data_result">
                                    <tr class="sep">
                                        <td colspan="8"></td>
                                    </tr>
                                    <tr class="info">
                                        <td colspan="7"><code>{{d.type==1?'普通商品':'预售商品'}}</code> 订单号：{{d.id}}
                                            <!-- <span v-if="d.interface_state!=0 && d.state==1" class="label label-warning inteeface_state" @dblclick="reSetPushOrder(d.id)">
                                        {{d.interface_state_name}}</span><span v-if="d.interface_state!=0 && d.state==1"> - {{d.interface_phone}} - {{d.interface_oder_id}}-{{d.interface_error_msg}}</span>
                                           <button v-if="(d.interface_state!=0 && d.state==1)&&(d.interface_state==1 || d.interface_state==97)" type="button"  @click="postOrder(d,$event)" class="btn btn-primary btn-xs">推送订单</button>
                                         -->
                                            <code v-if="d.refund_remark!=null">{{d.refund_remark}}</code>
                                        </td>
                                        <td colspan="2" align="right"><a :href="'/system/order/detail/'+d.id">订单详情</a>
                                            <!-- - <a :href="'/system/order/commissionDetails/'+d.id">佣金详情</a>-->
                                        </td>
                                    </tr>
                                    <tr class="detail" v-for="(i,index) in d.items" v-if="index==0">
                                        <td class="td1" :data-id="i.item_id">
                                            <img :src="i.image_center" />
                                            <a href="javascript:;" class="name">{{i.product_name}}</a>
                                            <p><b :class="'skuText'+i.item_id">{{i.sku_text}}</b>
                                                <a v-if="i.sku_text!=null && i.sku_text!=''" href="javascript:;">修改</a>
                                            </p>
                                        </td>
                                        <td class="td2">
                                            <p v-if="i.sku_price!=null && i.sku_price!=''">{{i.sku_price}}</p>
                                            <p v-else>{{i.product_price}}</p>
                                            <p>{{i.nums}} 件</p>
                                        </td>
                                        <td class="td8" v-if="i.refund!=null">
                                            <a v-if="i.refund_state!=1&&i.refund.is_active_refund!=1" class="">{{i.refund_state_name}}</a>
                                            <a v-else class="">{{i.refund_state_name}}</a>
                                        </td>
                                        <td class="td8" v-else>
                                            <a v-if="i.refund_state!=1" :href="'/system/order/refund_detail/'+i.item_id" class="">{{i.refund_state_name}}</a>
                                        </td>
                                        <td class="td3">
                                            <p>{{d.express_amount}}</p>
                                            <!-- <a v-if="d.state==0" href="javascript:;" @click="expressAmount(d)">修改</a> -->
                                        </td>
                                        <td class="td4">
                                            <p>{{d.total_amount}}</p>
                                            <!-- <a v-if="d.state==0" href="javascript:;" @click="totalAmount(d)">修改</a> -->
                                        </td>
                                        <td class="td5">
                                            <p><b>{{d.express_address}}</b></p>
                                        </td>
                                        <td class="td6">{{d.createtime}}</td>
                                        <td class="td7">
                                            <p>{{d.express_receive_name}}</p>
                                            <p>{{d.express_phone}}</p>
                                        </td>
                                        <td class="td9">
                                            <p v-if="d.state==0">{{d.state_name}}</p>
                                            <p v-if="d.state==1" :class="d.id">
                                                <span v-if="d.type==1">
                                                        {{d.state_name}}
                                                    </span>
                                                <span v-else>
                                                        <label v-show="d.is_presale_state==1">待支付定金</label>
                                                        <label v-show="d.is_presale_state==2">待支付尾款</label>
                                                        <label v-show="d.is_presale_state==3">{{d.state_name}}</label>
                                                    </span>
                                            </p>
                                        </td>
                                    </tr>


                                    <!-- <tr>
                                        <td>{{d.id}}</td>
                                        <td>

                                        </td>
                                    </tr> -->
                                </tbody>
                                <tbody id="tbody_body" v-if="data_result.length==0">
                                    <tr>
                                        <td colspan="13" style="text-align:center;height:300px">
                                            <h1>没有数据</h1>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
<!--                            <input type="button" value="后退" onclick="javascript:history.go(-1);">-->

                            <fieldset id="gexin_page" class="layui-elem-field layui-field-title"></fieldset>
                        </div>




                    </div>
                    <%};%>